<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>登录 - {$site.title|default=''}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__STATIC__/admin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__STATIC__/admin/style/admin.css" media="all">
    <link rel="stylesheet" href="__STATIC__/admin/style/login.css" media="all">
</head>
<body>
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
    <form method="post" class="layui-form" id="form_login">
        <div class="layadmin-user-login-main">
            <div class="layadmin-user-login-box layadmin-user-login-header">
                <h2>{$site.title|default=''}</h2>
                <p></p>
            </div>
            <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-username"></label>
                    <input type="text"  name="username" id="username" autocomplete="off" lay-verify="required" placeholder="请输入登录账号" class="layui-input">
                </div>
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-password"></label>
                    <input type="password" name="password" id="password" autocomplete="off"  lay-verify="required" placeholder="请输入账号密码" class="layui-input">
                </div>
                <div class="layui-form-item">
                    <button id="form_submit" class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 录</button>
                </div>
            </div>
        </div>
    </form>
    <div class="layui-trans layadmin-user-login-footer">
        <p>{$site.copyright|default=''}</p>
    </div>
</div>
<script src="__STATIC__/admin/layui/layui.js"></script>
<script src="__STATIC__/admin/js/jquery-3.6.0.min.js"></script>
<script src="__STATIC__/admin/js/md5.js"></script>
<script type="text/javascript">
    $(function(){
        let username = $('#username');
        username.focus(function(){
            $(this).attr('placeholder','');
        });
        username.blur(function(){
            $(this).attr('placeholder','请输入登录账号');
        });
        let password = $('#password');
        password.focus(function(){
            $(this).attr('placeholder','');
        });
        password.blur(function(){
            $(this).attr('placeholder','请输入账号密码');
        });
        $('#form_login').attr('autocomplete', 'off').submit(function(){
            let username = $("#username").val();
            let password = $("#password").val();
            if (password !== ''){
                password = md5(password);
            }
            $.post("{:url('/Login/into')}", {username:username,password:password}, function(result){
                $('#form_submit').text(result['message']);
                layui.use(['layer'], function () {
                    let layer = layui.layer;
                    layer.msg(result['message']);
                });
                if(result['status'] == 1000){
                    $('#password').val(password);
                    window.location.href = "{:url('/Index/index')}";
                }
            });
            return false;
        });
    });
</script>
</body>
</html>